//顶部登录名字的判定
require(['./config'], () => {
    require(['myCookie'], () => {
        // 顶部登录名字
        let user = document.querySelector(".user")

        function inital() {
            if (getCookie("userName")) {
                user.innerHTML = getCookie("userName")
                // span.innerHTML = getCookie("userName")
            }
        }
        inital()
        //猜你喜欢
    })
})

//初始化轮播图
var mySwiper = new Swiper('.swiper', {
    direction: 'horizontal', // 垂直切换选项
    loop: true, // 循环模式选项

    // 如果需要前进后退按钮
    navigation: {
        nextEl: '.swiper-button-next',
        prevEl: '.swiper-button-prev',
    },

})

function backTop() {
    let btn = document.querySelector("#backTop")
    btn.onclick = () => {
        document.documentElement.scrollTop = 0
    }
}
backTop()

window.onscroll = () => {
    if (document.documentElement.scrollTop > 750) {
        let wy = document.querySelector("#wy")
        wy.style.display = "block"
    } else {
        let wy = document.querySelector("#wy")
        wy.style.display = "none"
    }
}